package io;

import java.io.*;

public class Test6 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {


        File dir = new File(".");
        File[] subs = dir.listFiles(file -> file.getName().endsWith(".obj"));
        for (int i = 0; i < subs.length; i++) {
            if("user.obj".equals(subs[i].getName())){

                String str = subs[i].getName();
                FileInputStream fis = new FileInputStream(str);
                ObjectInputStream ois = new ObjectInputStream(fis);
                User o = (User) ois.readObject();
                System.out.println(o);
                ois.close();
            }
        }

    }
}
